home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 October / macformat-029.iso / mac / Shareware City / Developers / LControlPanel & Friends ƒ / LControlPanel.cp < prev    next >
Encoding:
Text File  |  1995-06-22  |  1.4 KB  |  75 lines  |  [TEXT/MMCC]

  1. /*
  2.     LControlPanel
  3.     
  4.     PowerPlant-based control panel.
  5.     ©1995 Chris K. Thomas.  All Rights Reserved.
  6. */
  7.  
  8. // * includes
  9. #include <LGrafPortView.h>
  10. #include "LControlPanel.h"
  11. #include <UDrawingState.h>
  12. //#include <UEnvironment.h>
  13.  
  14. #define DebugMe(x) //DebugStr(x)
  15.  
  16. // * implementation
  17. LControlPanel::LControlPanel(DialogPtr inCPDialog)
  18. :StdControlPanel(inCPDialog)
  19. {
  20.     UQDGlobals::SetQDGlobals((QDGlobals *) (LMGetCurrentA5() - (sizeof(QDGlobals) - 4)));
  21.     
  22.     Int32        qdVersion = gestaltOriginalQD;
  23.     Gestalt(gestaltQuickdrawVersion, &qdVersion);
  24. //    UEnvironment::SetFeature(env_SupportsColor,
  25. //                             (qdVersion > gestaltOriginalQD))
  26.     
  27.     // uncomment the above if you need to link with UEnvironment-
  28.     // most PP classes don't appear to use it!
  29.     
  30.     mOverView = new LGrafPortView(inCPDialog);
  31.     ThrowIfNULL_(mOverView);
  32. }
  33.  
  34. LControlPanel::~LControlPanel()
  35. {
  36.     if(mOverView)
  37.         delete mOverView;
  38. }
  39.  
  40. void LControlPanel::Update()
  41. {
  42.     DebugMe("\pUpdate");
  43.     mOverView->Draw(NULL);
  44. }
  45.  
  46. void LControlPanel::Click()
  47. {
  48.     DebugMe("\pClick");
  49.     mOverView->ClickInContent(mLastEvent);
  50. }
  51.  
  52. void LControlPanel::Activate()
  53. {
  54.     DebugMe("\pActivate");
  55.     mOverView->Activate();
  56. }
  57.  
  58. void LControlPanel::Deactivate()
  59. {
  60.     DebugMe("\pDeactivate");
  61.     mOverView->Deactivate();
  62. }
  63.  
  64. void LControlPanel::KeyDown()
  65. {
  66.     DebugMe("\pKeyDown");
  67.     mOverView->DoKeyPress(mLastEvent);
  68. }
  69.  
  70. void LControlPanel::Idle()
  71. {
  72.     DebugMe("\pIdle");
  73.     mOverView->DoIdle(mLastEvent);
  74. }
  75.